#-----"-g": generate debug info for gdb, etc.
#----"-O2": optimize the produced code to level 2.
#-----"-I": the path of depended header files.
MySQLincludePath=/usr/include/mysql
MySQLPPIncludePath=/usr/local/include/mysql++/

.PHONY: all clean run

all: simple2 transaction

simple2: cmdline.o printdata.o simple2.o
	g++ -o simple2 cmdline.o printdata.o simple2.o -L/usr/lib/mysql/ -L/usr/local/lib   -lmysqlclient   -lmysqlpp 
transaction: cmdline.o printdata.o transaction.o
	g++ -o transaction cmdline.o printdata.o transaction.o  -L/usr/lib/mysql/ -L/usr/local/lib    -lmysqlclient   -lmysqlpp 
	
cmdline.o: cmdline.cpp
	g++ -c -o cmdline.o     -I$(MySQLPPIncludePath)      -I$(MySQLincludePath) -g -O2 ./cmdline.cpp
printdata.o: printdata.cpp
	g++ -c -o printdata.o   -I$(MySQLPPIncludePath)      -I$(MySQLincludePath) -g -O2 ./printdata.cpp
simple2.o: simple2.cpp
	g++ -c -o simple2.o     -I$(MySQLPPIncludePath)      -I$(MySQLincludePath) -g -O2 ./simple2.cpp
transaction.o: transaction.cpp
	g++ -c -o transaction.o -I$(MySQLPPIncludePath)      -I$(MySQLincludePath) -g -O2 ./transaction.cpp

run:
	./simple2
	./transaction
clean:
	rm -f *.o simple2 transaction
